<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>直接量创建函数</title>
</head>
<body>
            <script>               //1.定义属性并读取
                var s = {
                    name:'tom',    //定义属性
                    age:24,
                    say:function () {      //  定义一个方法并执行
                        console.log(this.name);       //在方法中读取属性
                        console.log(this.age);
                    },
                    say2:function () {
                        this.name = 'fank';       //在方法中修改属性再读取
                    }
                };
                s.say2();     //要放在say()前面才能生效
                s.say();


            </script>
</body>
</html>